{% extends "registration/base.html" %}

{% block content %}
  <div style="max-width: 400px; margin: auto;">
    {% if form.errors %}
      <p style="color: red;">Your username and password didn't match. Please try again.</p>
    {% endif %}

    {% if next %}
      {% if user.is_authenticated %}
        <p>Your account doesn't have access to this page. To proceed,
        please login with an account that has access.</p>
      {% else %}
        <p style="color: red;">Please login to see this page.</p>
      {% endif %}
    {% endif %}

    <form method="post" action="{% url 'login' %}" style="background-color: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);">
      {% csrf_token %}
      <h2 style="text-align: center; margin-bottom: 20px;">Вход</h2>
      <label for="username">Имя пользователя:</label>
      <input type="text" id="username" name="username" required style="width: 100%; padding: 10px; margin-bottom: 15px; box-sizing: border-box;">

      <label for="password">Пароль:</label>
      <input type="password" id="password" name="password" required style="width: 100%; padding: 10px; margin-bottom: 15px; box-sizing: border-box;">

      <input type="submit" value="Войти" style="background-color: #4CAF50; color: white; padding: 12px; border: none; border-radius: 4px; cursor: pointer; width: 100%;">
      <input type="hidden" name="next" value="{{ next }}">
    </form>

    {# Assumes you setup the password_reset view in your URLconf #}
    <p style="text-align: center; margin-top: 20px;"><a href="{% url 'password_reset' %}">Забыли пароль?</a></p>
  </div>
{% endblock %}
